package com.kmxd.ams.app.event.involume;

import com.kmxd.ams.app.arrange.command.ArchCodeGenCmd;
import com.kmxd.ams.client.event.involume.ChangeInVolumeArchCodeEvent;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.transaction.event.TransactionalEventListener;

/**
 * 刷新案卷下文档档号
 *
 * @author nickbi
 */
@Slf4j
@Component
@AllArgsConstructor
public class RefreshDocumentArchCodeListener {
  private final ArchCodeGenCmd archCodeGenCmd;

  @Async
  @TransactionalEventListener(fallbackExecution = true)
  public void refresh(ChangeInVolumeArchCodeEvent event) {
    archCodeGenCmd.refreshDocumentArchCode(event);
  }
}
